package ch.rouge66.energymonitor.dao;

import java.util.List;

import org.hibernate.Query;

public interface GenericDao<T extends Entity> {

    /** Persist the newInstance object into database */
    T create(T newInstance);

    /** Retrieve an object that was previously persisted to the database using
     *   the indicated id as primary key
     */
    T readById(Long id);

    /** Save changes made to a persistent object.  */
    void update(T transientObject);

    /** Remove an object from persistent storage in the database */
    void delete(T persistentObject);

    public List<T> readByQuery(Query query);

    public List<T> readAll();

}

